<?php

class UserPresenter extends Robbo\Presenter\Presenter {

    /**
     * add ->role for User instance in View
     * @author Trung Vuong
     * @return string
     */
    public function presentRole()
    {
        $groups = $this->getGroups();
        $group_names = array();
        foreach ($groups as $group) {
            array_push($group_names, Lang::get("group.name.{$group->getName()}"));
        }
        return join(', ', $group_names);
    }
    
    /**
     * add ->group_id for User instance in View
     * @author Trung Vuong
     * @return int
     */
    public function presentGroupId()
    {
        return $this->getGroupId();
    }
    
    /**
     * add ->edit_url for User instance in View
     * @author Trung Vuong
     * @return string
     */
    public function presentEditUrl()
    {
        return route('user.edit', $this->id);
    }

    /**
     * add ->destroy_url for User instance in View
     * @author Trung Vuong
     * @return string
     */
    public function presentDestroyUrl()
    {
        return route('user.destroy', $this->id);
    }
    
}